package com.bjpowernode.p2p.web;

import com.bjpowernode.p2p.service.KuaiQianService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * ClassName:PayKuaiQianController
 * Package:com.bjpowernode.p2p.web
 * Description: 描述信息
 *
 * @date:2021/9/3 16:12
 * @author:sjf
 * @Copyright:动力节点
 */

@Controller
public class PayKuaiQianController {

    @Autowired
    private KuaiQianService kuaiQianService;


    @GetMapping("/kq/notify")
    public void receiveKQNotify(HttpServletRequest request, HttpServletResponse response) throws IOException {
        System.out.println("======notify======");
        try {
            kuaiQianService.handlerKQNotify(request);
        }finally {
            PrintWriter out = response.getWriter();
            out.println("<result>1</result><redirecturl>http://47.113.198.114:9999/showKQ.html</redirecturl>");
            out.flush();
            out.close();
        }


    }
}
